//
//  UFOLQCNewTableViewCell.m
//  unrivalledForUniverse
//
//  Created by dllo on 1/11/16.
//  Copyright © 2016 dllo. All rights reserved.
//

#import "UFOLQCNewTableViewCell.h"



@implementation UFOLQCNewTableViewCell

- (void)dealloc
{
    [_image release];
    [_titleL release];
    [_detailsL release];
    [_pubDateL release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubviews];
    }
    return self;
}

- (void)createSubviews
{
    self.image = [UIImageView new];
    self.image.backgroundColor = [UIColor redColor];
    [self addSubview:self.image];
    
    self.titleL = [UILabel new];
    self.titleL.font = [UIFont systemFontOfSize:16];
    [self addSubview:self.titleL];
    
    self.detailsL = [UILabel new];
    self.detailsL.numberOfLines = 2;
    self.detailsL.font = [UIFont systemFontOfSize:14];
    self.detailsL.textColor = [UIColor colorWithWhite:0.298 alpha:1.000];
    self.detailsL.textAlignment = UIControlContentVerticalAlignmentFill;
    self.detailsL.lineBreakMode = NSLineBreakByCharWrapping;
    [self addSubview:self.detailsL];
    
    self.pubDateL = [UILabel new];
    self.pubDateL.textAlignment = NSTextAlignmentRight;
    self.pubDateL.textColor = [UIColor colorWithWhite:0.298 alpha:1.000];
    self.pubDateL.font = [UIFont systemFontOfSize:13];
    [self addSubview:self.pubDateL];
    
    [self.image mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self).offset(5);
        make.left.equalTo(self).offset(10);
        make.bottom.equalTo(self).offset(-5);
        make.width.equalTo(@80);
    }];
   
    
    [self.titleL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.image.mas_right).offset(10);
        make.top.equalTo(self).offset(5);
        make.right.equalTo(self).offset(-10);
        make.height.mas_equalTo(@20);
    }];
    
    [self.detailsL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.image.mas_right).offset(10);
        make.top.equalTo(self.titleL.mas_bottom).offset(0);
        make.right.equalTo(self).offset(-10);
        make.bottom.equalTo(self).offset(-5);
    }];
    
    [self.pubDateL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self).offset(-10);
        make.bottom.equalTo(self).offset(-5);
        make.top.equalTo(self.titleL.mas_bottom).offset(20);
        make.width.mas_equalTo(80);
    }];
    
}

@end
